<template>
    <el-dialog
        title="置顶设置"
        :visible.sync="dialogVisible"
        size="60%"
        custom-class="set-top-pop"
        :before-close="handleClose">
        <div style="margin-bottom: 30px">
            <H3>当前{{pageType === 'job' ? '职位' : '企业'}}</H3>
            <el-table :data="tableData" size="mini" max-height="240" border fit>
                <el-table-column label="职位名称" prop="name" v-if="pageType === 'job'" />
                <el-table-column label="企业名称" prop="companyName" />
            </el-table>
            <H3 style="margin-top: 60px">是否置顶</H3>
            
            
            <FormGroup style="margin-top: 20px" :searchConfig="resultTypeConfig" ref="formParams" labelWidth="160px" labelPosition="right" />
        </div>
        <span class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="handleConfirm">确 定</el-button>
        </span>
    </el-dialog>
</template>
<script>
import FormGroup from '@/views/components/FormGroup'
// import { resultTypeConfig, TYPE } from '../initData';
import FileUpload from '@/components/FileUpload'
import { createNewsStudyType } from '@/api/content-manage/researchResult.js'
export default {
  name: 'AddPop',
  components: {
    FormGroup,
    FileUpload
  },
  data() {
    return {
      dialogVisible: false,
      resultTypeConfig: [],
      tableData: [],
      isHot: '',
      isNew: '',
      pageType: ''
    }
  },
  methods: {

    open({tableData, formConfig, pageType}) {
        this.pageType = pageType;
        this.resultTypeConfig = JSON.parse(JSON.stringify(formConfig));
        this.tableData = tableData;
        this.dialogVisible = true;
        this.$refs.formParams && this.$refs.formParams.resetFields();
    },
    handleClose() {
        this.dialogVisible = false;
    },
    async handleConfirm() {
        const fromParams = this.$refs.formParams && await this.$refs.formParams.getParams();
        console.log(fromParams, '---fromParams===')
        this.$emit('handleConfirm', {
            tableData: this.tableData,
            ...fromParams,
            done: this.handleClose
        });
    },
  }
}
</script>

<style lang='scss'>
    .set-top-pop {
        .el-drawer__body {
            padding: 15px 20px;
        }
        .basic-infos {

            .title {
                padding: 3px 10px;
                border-left: 2px solid rgb(20, 165, 232);
                margin-bottom: 20px;
            }
        }
        .radio-box {
            display: flex;
            justify-content: start;
            margin-top: 40px;
            align-items: center;

            .title {
                margin-right: 10px;
            }
        }
    }
</style>
